home *** CD-ROM | disk | FTP | other *** search
- Path: news.bridge.net!news
- From: David Byrden <100101.2547@compuserve.com>
- Newsgroups: comp.lang.c++
- Subject: Re: copy ctor and derived classes
- Date: 13 Jan 1996 00:24:07 GMT
- Organization: self-employed
- Message-ID: <4d6u37$3b7@news.bridge.net>
- References: <DL38zz.50K@Virginia.EDU>
- NNTP-Posting-Host: ppp-mia1-64.bridge.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
-
-
- Greg;
-
- >> how can I invoke the base class's copy constructor in the
- >> intialization list the derived class doesn't have to deal
- >> with all of the little bits of the base class?
-
-
- The derived class has no RIGHT to deal with all the bits of the
- base class. They can be private.
-
- Here's what to do:
-
-
- Derived::Derived( const Derived& rhs ) // copy ctor
- : Base( *this ) // invoke base's copy ctor
- {
-
- }
-
-
- The copy ctor which the compiler can silently fgenerate for you,will do
- this a utomatically.
-
-